<template>
   <div id="vip">
    <el-row class="tac">
    <el-menu router>
      <el-submenu index="/reg" >
           <template slot="title">
          <i class="el-icon-user-solid" ></i><span>会员中心</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="myVip" @click="CheckVip">我的会员</el-menu-item>
          <el-menu-item index="1-2">会员成长</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
    </el-menu>
</el-row>
<epaimyvip ></epaimyvip>
<wallet></wallet>
</div> 
</template>

<script>
import epaimyvip from '../views/epai_vip_register'
import wallet from '../views/e_wallet'

   export default {
     name:'vip',
     components:{
       epaimyvip,
       wallet
     },
     data(){
       return{
        
       }  
     },
      methods:{
        CheckVip(){
          //发送ajax请求到后台，加载数据
          this.$ax.get('/epai/user/getVipStatus',{params:{
             userId:2
          }}).then((response)=>{//axios返回的response并不是后端响应数据，而是经过了封装，提供更为丰富的数据
              if(response.data.success){
                 this.$router.push({path:'/vips'});
              }else if(response.data.fail){
                alert("当前用户不是VIP");
              }else{
                this.$notify({
                  title:'提示',
                  message:response.data.message,
                  type:'error',
                  duration:1000
                })
              } 
            });
        },


      }
    
}
</script>
